
<template>
  <div>
    <s-form-table :fields="fields"
                  ref="table"
                  :transformParams="transformParams"
                  :getData="getData"
                  :columns="columns">
      <template slot="evalValue" slot-scope="{ row }">
        {{ getText(row) }}
      </template>
    </s-form-table>
  </div>
</template>

<script>
import SFormTable from "@/components/SFormTable"
import api from "@/util/api";
import moment from "moment";
import { message } from "ant-design-vue";
export default {
  components: {
    SFormTable
  },
  filters: {},
  props: {},
  data () {
    return {
      detail: null,
      getUrl: "/api/order/getOrders",
      title: "",
      fields: [
        {
          name: "status",
          width: 256,
          placeholder: "请选择评价类型",
          defaultValue: 0,
          options: [
            {
              title: "全部",
              value: 0
            },
            {
              title: "未付款",
              value: 1
            },
            {
              title: "已付款",
              value: 2
            },
            {
              title: "已接单",
              value: 3
            },
            {
              title: "已发货",
              value: 4
            },
            ,
            {
              title: "已完成",
              value: 5
            },
            {
              title: "已取消",
              value: 7
            }
          ],
          type: "select"
        }
      ],
      columns: [
        {
          title: "订单ID",
          dataIndex: "orderId",
          fixed: "left",
          align: "center"
        },
        {
          title: "手机号码",
          dataIndex: "mobile",
          align: "center"
        },
        {
          title: "总价(￥)",
          dataIndex: "totalMoney",
          align: "center"
        },
        {
          title: "备注",
          dataIndex: "remarks",
          align: "center"
        },
        {
          title: "创建日期",
          dataIndex: "createTime",
          align: "center"
        }
      ]
    };
  },
  watch: {
  },
  methods: {
    getData (params) {
      return new Promise((resolve) => {
        api.get(`/api/order/getOrders`, { params }).then(res => {
          if (res) {
            resolve({
              page: {
                total: res.total
              },
              data: res.rows || []
            })
          }
        });
      });
    },
    // 修改默认fields的参数（接口）
    transformParams (params) {
      params.rows = params.pageSize
      return params
    },
    refresh () {
      this.$refs.table.search();
    },
    getText(row) {
      let text = ["差评", "中评", "好评"]
      return r
    }
  }
};
</script>

<style lang="scss" scoped></style>
